﻿<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <title>试卷预览</title>


    <!-- Le styles -->

    <link href="~/Scripts/NewFiles/bootstrap.min.css" rel="stylesheet" />

    <link href="~/Scripts/NewFiles/bootstrap-responsive.min.css" rel="stylesheet" />
    <link rel="stylesheet" type="text/css" media="screen" href="~/css/smartadmin-skins.css">

    <link href="~/Scripts/NewFiles/prettify.css" rel="stylesheet" />
    <link href="~/Scripts/NewFiles/docs.css" rel="stylesheet" />
    <style type="text/css">
        body {
        margin:0px 40px;
        }
    </style>

</head>

<body data-spy="scroll" style="margin-bottom:20px;">
    <h2>@ViewBag.paper.STestName</h2>
    <input value="@ViewBag.paper.IPaperId" type="hidden" id="paperId"/>
    <h4>学号：<span id="stuCode">@ViewBag.paper.SStuCode</span> | 班级：@ViewBag.paper.SClassName</h4>
    <h4>得分：@ViewBag.score</h4>
    <hr />

    <div>

        @{ 
            var i = 0;
            string[] str = { "一、", "二、", "三、", "四、", "五、", "六、", "七、", "八、", "九、", "十、", "十一、",
                             "十二、","十三、","十四、","十五、","十六、","十七、","十八、","十九、","二十、","二十一、",
                             "二十二、","二十三、","二十四、","二十五、","二十六、","二十七、","二十八、","二十九、","三十、"};   //大题编号
                           
        }
        @foreach (var a in ViewBag.TestPaperDetail)
        {
            i++;
            var pid = "s" + i;
            var qNo = 0;     //大题里面小题题号   
            <!--获取试题的大题信息-->
            <div>

                <p class="font-md" id="@pid">
                    @str[i - 1] @a.StrategyItem.STitle （总分：@a.StrategyItem.IScore | 得分：@a.stuGetScore）
                </p>



                @foreach (var b in a.LibItemList)//标题
                {
                    qNo++;
                    string tempstr = qNo + ". ";
                    string tempHref = "/TeacherManger/ChangeQuestionView?CourseID=1&ProblemType=" + b.LibItem.IProblemType + "&PaperDetailId=" + b.LibItem.Id + "&IStrategyID=" + a.StrategyItem.Id;//转跳到试题列表
                    <!--小题题块-->
                    <div id="@b.LibItem.Id">

                        <!--获取小题的题型  todo-->
                        <input type="hidden" id="TestLbId" value="@b.LibItem.IProblemType" />

                        <!--小题内容-->
                        <div style="min-height: 150px">
                            <label class="font-md">
                                @tempstr @b.LibItem.STitle
                            </label>
                            <br />
                            @{
                    string trueAnswer = "";
                    int tempI = 0;//用于标记选项
                    string[] Option = { "A.", "B.", "C.", "D.", "E.", "F.", "G.", "H." };
                    string color = b.isOk == 0 ? "red" : "green"; 
                                <table class="smart-form" style="display: inline;">
                                    @foreach (var c in b.OptionList)
                                    {
                                        string OptionStr = "Option" + qNo;
                                       
                                        <tr>
                                            <td style="padding-left: 10px;" class="font-md">@Option[tempI] @c.SOptionName</td>
                                        </tr>
                                        tempI++;
                                        if (c.IIsTrue == 1)
                                        {
                                            trueAnswer = trueAnswer + "," + c.SOptionName;
                                        }
                                    }
                                    @{trueAnswer = trueAnswer.Substring(1, trueAnswer.Length - 1);}
                                </table>
                                <div style="width: 50%; height: 100%; float: right;">
                                    @{string StuAnswer =
                                      string.IsNullOrEmpty(b.StuAnswer) ? " " :
                                      b.StuAnswer.Substring(1, b.StuAnswer.Length - 1);}
                                    <span style="font-size:16px;color:@color">学生答案：@StuAnswer</span>
                                    <br />
                                    <br />
                                    <span style="font-size: 16px;">正确答案：@trueAnswer</span>
                                </div>
                                <hr />
                            }

                        </div>
                        <!--end 小题内容-->



                    </div>
                    <!-- end 小题题块-->
                }
            </div> 
            <!--end 获取试题的大题信息--> 
        }
    </div>
    <button class="btn btn-primary" id="readSuccess">阅卷完成</button>
    <a class="btn btn-inverse" href="/Teacher/MarkPaper?paperId=@ViewBag.paper.IPaperId">返回</a>

    <script src="~/Scripts/jquery-1.8.2.min.js"></script>
    <script src="~/Scripts/NewFiles/bootstrap.min.js"></script>
    <script src="~/Scripts/NewFiles/holder.min.js"></script>
    <script src="~/Scripts/NewFiles/application.js"></script>

    <script src="~/Scripts/NewFiles/prettify.js"></script>
    <script type="text/javascript">
        $(function () {
            $("#readSuccess").click(function () {
                $.ajax({
                    url: "/Api/Teacher/ReadPaper",
                    type: "POST",
                    dataType: "JSON",
                    data: { paperId: $("#paperId").val(), stuCode: $("#stuCode").text() }
                }).done(function (data) {
                    if (data == 1) {
                        alert("阅卷完成！");
                        window.location.href = "/Teacher/MarkPaper?paperId=" + $("#paperId").val();
                    }
                    else {
                        alert("提交数据失败！请重新点击")
                    }
                })
            });
        })
    </script>
</body>
</html>
